<template>
  <el-cascader
    v-model="result"
    :options="list"
    @change="handleChange"
    clearable
    :props="props.props"
    filterable
  />
</template>

<script setup name="MyCascader">
import options from "@/views/components/common/city";
import { computed, onMounted } from "vue";
const emit = defineEmits(["update:modelValue"]);
const props = defineProps({
  modelValue: {
    default: "",
  },
  props: {
    default: {
      label: "Name",
      value: "ID",
      children: "children",
      leaf: "leaf",
    },
  },
  Category: { default: "籍贯" },
});
const list = ref([]);
const result = computed({
  get: () => {
    return props.modelValue;
  },
  set: (val) => {},
});
onMounted(() => {
  init();
});
function init() {
  switch (props.Category) {
    case "籍贯":
      list.value = options;
      break;
  }
}
function handleChange(val) {
  emit("update:modelValue", val);
}
</script>

<style lang="scss" scoped></style>
